package com.ruiyian.common.constant;

import io.jsonwebtoken.Claims;

/**
 * 通用常量信息
 *
 * @author ruiyian
 */
public class Constants
{
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";

    /**
     * 通用成功标识
     */
    public static final String SUCCESS = "0";

    /**
     * 通用失败标识
     */
    public static final String FAIL = "1";

    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "Success";

    /**
     * 注销
     */
    public static final String LOGOUT = "Logout";

    /**
     * 注册
     */
    public static final String REGISTER = "Register";

    /**
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";

    /**
     * 验证码 redis key
     */
    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";

    /**
     * 登录用户 redis key
     */
    public static final String LOGIN_TOKEN_KEY = "login_tokens:";

    /**
     * 防重提交 redis key
     */
    public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";

    /**
     * 限流 redis key
     */
    public static final String RATE_LIMIT_KEY = "rate_limit:";

    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 2;

    /**
     * 令牌
     */
    public static final String TOKEN = "token";

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    /**
     * 令牌前缀
     */
    public static final String LOGIN_USER_KEY = "login_user_key";

    /**
     * 用户ID
     */
    public static final String JWT_USERID = "userid";

    /**
     * 用户名称
     */
    public static final String JWT_USERNAME = Claims.SUBJECT;

    /**
     * 用户头像
     */
    public static final String JWT_AVATAR = "avatar";

    /**
     * 创建时间
     */
    public static final String JWT_CREATED = "created";

    /**
     * 用户权限
     */
    public static final String JWT_AUTHORITIES = "authorities";

    /**
     * 参数管理 cache key
     */
    public static final String SYS_CONFIG_KEY = "sys_config:";

    /**
     * 字典管理 cache key
     */
    public static final String SYS_DICT_KEY = "sys_dict:";

    /**
     * 资源映射路径 前缀
     */
    public static final String RESOURCE_PREFIX = "/profile";

    /**
     * RMI 远程方法调用
     */
    public static final String LOOKUP_RMI = "rmi://";

    /**
     * LDAP 远程方法调用
     */
    public static final String LOOKUP_LDAP = "ldap://";

    /**
     * 正常
     */
    public static final Integer NORMAL = 0;
    /**
     * 删除
     */
    public static final Integer DELETE = 2;
    /**
     * 心跳
     */
    public static final String HEART_BEAT = "heart beat!";

    /**
     * 模型隧道数据key redis
     */
  /*  public static final String MODELKEY = "modelKey";  // 读取点位list

    public static final String TUNNEL_INFO = "tunnelInfo";


    public static final String WRITEPOINTKEY = "writePoint";
    public static final String WRITEVALUEKEY = "writeValue";

    public static final String NOWINDEX = "nowIndex";
    public static final String WRITEINDEX = "writeNowIndex";*/

    // 返回数据
    public static final String RETURNPOINT = "returnPoint";
    // 当前操作索引
    public static final String NOWINDEX = "nowIndex";
    // 操作点位集合
    public static final String POINTLIST = "pointList";

    // 返回数据
    public static final String RETURNPOINTTASK = "returnPointTask";

    // 当前操作索引
    public static final String NOWINDEXTASK = "nowIndexTask";
    // 操作点位集合
    public static final String POINTLISTTASK = "pointListTask";

    /**
     * plc配置常量
     */
    public static final int DEFAULT_GCT = 0x02;  //fixed, max 0x07
    public static final int DEFAULT_DNA = 0x00;  //destination network address, 0x00 = local
    public static final int DEFAULT_DA1 = 141;  //destination node address, host-link // PLC节点  71=113  废除 根据plc端口
    public static final int DEFAULT_DA2 = 0x00;  //destination unit address, 0x00 = CPU
    public static final int DEFAULT_SNA = 0x00;  //source network address, 0x00 = local
    public static final int DEFAULT_SA1 = 253;  //source node address, 0x00 = CPU   // 客户端节点  6E=110  需要配置

    public static final int DEFAULT_SA1_T = 130;  //source node address, 0x00 = CPU   // 客户端节点  6E=110  需要配置
    public static final int DEFAULT_SA2 = 0x00;  //source unit address, 0x00 = local
    public static final int DEFAULT_SID = 0xFF;  //source ID
    public static final int UNKNOWN_VALUE = -1;

    // 服务端口
    public static final int MAIN_PORT = 9086;
//    public static final int MODULE_PORT = 9088;
    //    public static final int MODULE_PORT = 9080;
    public static final int TCP_PORT = 9090;


    public static  final String SIMU="Simu";
    public static  final String RECORD="Record";

    public static final String TCP = "tcp";
    public static final String WEBSOCKET = "websocket";
}
